#include "MCAxis.h"
#include <MCSettings.h>
#include <MCUtils.h>
#include <iostream>

MCAxis::MCAxis(ICanvas *presenter) :
    MCGraphicsItem(presenter)
{
}

void MCAxis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    setPainter(painter);

    MCPoint2D zeroPoint = { MCSettings::AxisDrawingOffset.x, presenter->height() - MCSettings::AxisDrawingOffset.y };
    MCPoint2D upPoint = { zeroPoint.x, zeroPoint.y - MCSettings::AxisLength };
    MCPoint2D rightPoint = { zeroPoint.x + MCSettings::AxisLength, zeroPoint.y };
    double arrowSize = MCSettings::AxisArrowSize;

    painter->setPen(Qt::green);
    painter->setBrush(Qt::green);
    drawArrow2(zeroPoint, upPoint, arrowSize, 30, presenter->scale());

    painter->setPen(Qt::blue);
    painter->setBrush(Qt::blue);
    drawArrow2(zeroPoint, rightPoint, arrowSize, 30, presenter->scale());
}
